package yf.mall.entity;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.yf.utils.GenUtils;
import lombok.Setter;
import lombok.Getter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;


/**
 * 用户实体
 * 表名 user
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Tue Sep 17 15:12:41 CST 2019
 */
@Setter
@Getter
public class UserEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    //
    private Long id;
    //微信Openid
    private String openId;
    //微信统一ID
    private String unionId;
    //微信头像
    private String avatar;
    //手机号码
    private String mobile;
    //密码
    private String password;
    //名称
    private String name;
    //编码
    private String code;
    //团队编码
    @JsonProperty("tCode")
    private String tCode;
    //推荐人ID
    private Long rid;
    //上级ID
    private Long pid;
    //团队树
    private String team;
    //级别名称
    private Long levelId;
    //加入时间
    private Date time;
    //备注
    private String remark;
    //起止时间
    Date[] times;
    //ENUM-状态:"ACTIVE-正常","BAN-禁用"
    private Integer status;


    private String areaName;

    private Integer vip;

    //临时计数存储
    private BigDecimal temProfit = BigDecimal.ZERO;

    public UserEntity() {

    }


    public UserEntity(String mobile,String openId, String unionId, String avatar, String name, String code, String tCode, Long rid, Long pid, String team, Long levelId, Date time, Integer status) {
        this.mobile = mobile;
        this.openId = openId;
        this.unionId = unionId;
        this.avatar = avatar;
        this.name = name;
        this.code = code;
        this.tCode = tCode;
        this.rid = rid;
        this.pid = pid;
        this.team = team;
        this.levelId = levelId;
        this.time = time;
        this.status = status;
    }

    public static void main(String[] args) {
//        String jdbcUrl = "jdbc:mysql://localhost:3306/zbmall?serverTimezone=CTT";
        String jdbcUrl = "jdbc:mysql://localhost:3306/youx?serverTimezone=CTT";
        String userName = "root";
//        String password = "root";
        String password = "12345678";
        String packageName = "yf.mall";
      String filePath = "/Users/hxf/Desktop/autoCode.zip";
  //      String filePath = "e:/autoCode.zip";



        try {
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).generatorCode("mall_config");
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("mall_card").alias("mallCard").join("user").alias("user").on("mallCard.user_id","user.id").generateVoCode();
//           生成账户记录
//           GenUtils.init(jdbcUrl,userName,password,filePath,packageName).table("shop").alias("shop").join("user").alias("user").on("shop.code","user.code").generateVoCode();
            //生成用户
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("user").alias("user").join("user").alias("referer").on("user.rid", "referer.id").join("user").alias("topUser").on("user.pid", "topUser.id").join("level").alias("level").on("level.id", "user.level_id").generateVoCode();
//生成订单
//            GenUtils.init(jdbcUrl,userName,password,filePath,packageName).table("mall_order").alias("mallOrder").join("user").alias("user").on("mallOrder.user_id","user.id").join("user").alias("fromUser").on("mallOrder.from_user_id","fromUser.id").generateVoCode();
            //生成价格
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("price" ).alias("price" ).join("level" ).alias("level" ).on("price.level_id", "level.id" ).generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("account" ).alias("account" ).join("user" ).alias("user" ).on("record.from_user_id", "user.id" ).join("user").alias("toUser").on("record.to_user_id","fromUser.id").generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("sign" ).alias("sign" ).join("course" ).alias("course" ).on("sign.course_id", "course.id" ).generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("mall_act" ).alias("act" ).join("mall_goods" ).alias("goods" ).on("act.goods", "course.id" ).generateVoCode();
//              GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("coupon" ).alias("coupon" ).join("user" ).alias("user" ).on("user.id", "user_id" ).generateVoCode();
//              GenUtils.init(jdbcUrl, userName, password, filePath,packageName).generatorCode("goods_group");
              GenUtils.init(jdbcUrl, userName, password, filePath,packageName).generatorCode("sec_code");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
